﻿
@{
    ViewBag.Title = "商家银行卡";
}
@section CSS{

}
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            商家
            <small>银行卡</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li><a href="#">财务管理</a></li>
            <li class="active">商家银行卡</li>
        </ol>
    </section>
    <section>
        <div class="col-xs-12">
            <div class="box box-primary ">
                <!-- form start -->
                <form class="form-horizontal">
                    <div class="box-body">
                        <div class="form-group">
                            <label for="shopName" class="col-sm-2 control-label">店铺名称</label>
                            <div class="col-sm-2">
                                <input type="text" class="form-control" id="shopName" placeholder="店铺名称">
                            </div>
                            <label for="companyName" class="col-sm-2 control-label">公司名称</label>
                            <div class="col-sm-2">
                                <input type="text" class="form-control" id="companyName" placeholder="公司名称">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="status" class="col-sm-2 control-label">状态</label>
                            <div class="col-sm-2">
                                <select class="form-control" id="status">
                                    <option value="-1">-请选择状态-</option>
                                    <option value="0">待审核</option>
                                    <option value="1">审核成功</option>
                                    <option value="2">审核失败</option>
                                </select>
                            </div>
                            <label for="type" class="col-sm-2 control-label">账户类别</label>
                            <div class="col-sm-2">
                                <select class="form-control" id="type">
                                    <option value="-1">-请选择账户类别-</option>
                                    <option value="0">公司</option>
                                    <option value="1">个人</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer ">
                        <button type="button" class="btn btn-primary btn-search center-block" id="btnSearch"><i class="fa fa-search"></i> 查询</button>
                        @*<button type="button" class="btn btn-danger" id="btnDelMul"><i class="fa fa-remove"></i> 批量删除</button>
                            <button type="button" class="btn btn-info" id="btnAdd"><i class="fa fa-plus"></i> 添加</button>
                            <button type="button" class="btn btn-success" id="btnExport"><i class="fa fa-download"></i> 导出Excel</button>*@
                    </div>
                    <!-- /.box-footer -->
                </form>
            </div>
        </div>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    @*<div class="box-header">
                            &nbsp;
                        </div>*@
                    <!-- /.box-header -->
                    <div class="box-body">
                        <table id="DataList" class="table table-bordered table-striped table-hover ">
                            <thead>
                                <tr>
                                    <th>编号</th>
                                    <th>店铺名称</th>
                                    <th>公司名称</th>
                                    <th>银行</th>
                                    <th>银行卡号</th>
                                    <th>账户类别</th>
                                    <th>审核状态</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody> </tbody>
                        </table>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>
    <!-- /.content -->
</div>
<!-- /.content-wrapper -->
@section JS{
    <script>
        $(function () {
            //初始化表格
            GenerateTable();
            //鼠标移动到该行变色
            $('.table-hover tbody').on('click', 'tr', function () {
                if ($(this).hasClass('selected')) {
                    $(this).removeClass('selected');
                }
                else {
                    u_table.$('tr.selected').removeClass('selected');
                    $(this).addClass('selected');
                }
            });
            //搜索事件
            $("#btnSearch").on("click", function () {
                u_table.fnDestroy();
                GenerateTable();
            });

            $('#startTime').datepicker({
                autoclose: true
            });

            $('#endTime').datepicker({
                autoclose: true
            });
        });
        //生成表格
        function GenerateTable() {
            u_table = $('#DataList').dataTable({
                "lengthChange": true,
                "searching": false,
                "ordering": false,
                "iDisplayLength": 10,
                "bProcessing": true,
                "bServerSide": true,
                "fnServerParams": function (aoData) {
                    var status = $("#status").val();
                    //var datemin = $('#startTime').val();
                    //var datemax = $("#endTime").val();
                    var shopName = $("#shopName").val();
                    var companyName = $("#companyName").val();
                    aoData.push(
                        { "name": "dateMin", "value": ""},
                        { "name": "dateMax", "value": "" },
                        { "name": "shopName", "value": shopName },
                        { "name": "companyName", "value": companyName },
                        { "name": "status", "value": status }
                    );
                },
                "sAjaxSource": "/finance/ShopBankCardList",
                "aoColumns": [
                    { "mDataProp": 'id' },
                    { "mDataProp": 'shop_name' },
                    { "mDataProp": 'company_name' },
                    { "mDataProp": 'bank_name' },
                    { "mDataProp": 'bank_cardno' },
                    {
                        "mDataProp": 'types', "mRender": function (data, type, full) {
                            return data==0?"公司":(data==1?"个人":"");
                        }
                    },
                    {
                        "mDataProp": 'status', "mRender": function (data, type, full) {
                            return data == 0 ? "<span style='color:orange'>待审核</span>" : (data == 1 ? "<span style='color:green'>成功</span>" : "<span style='color:red'>拒绝</span>");
                        }
                    },
                     {
                        "mDataProp": 'id', "mRender": function (data, type, full) {
                            return "<a href='javascript:void(0);' onclick='admin_edit(\"银行卡审核\",\"/Finance/ShopBankCardDeal\"," + data + ",900,810)'  title='审核'>"+(full.status==0?"审核":"详情")+"</a>";
                        }
                    }
                ]
            });
        }

        /*编辑*/
        function admin_edit(title, url, id, w, h) {
            layer_show(title, url, id, w, h);
        };
    </script>
}


